//
//  SLHomeHeadView.m
//  StarLight
//
//  Created by apple on 16/7/30.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

#import "SLHomeHeadView.h"
#import "SDCycleScrollView.h"

@interface SLHomeHeadView ()<SDCycleScrollViewDelegate>

@end

@implementation SLHomeHeadView

- (instancetype)initWithFrame:(CGRect)frame list:(NSArray *)list
{
    if (self = [super initWithFrame:frame]) {
    }
    return self;
}
- (void)cellForPicModel:(NSMutableArray *)arr
{
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-20, 161 * MIX_H) delegate:self placeholderImage:[UIImage imageNamed:@"head"]];
    
    cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    cycleScrollView.currentPageDotColor = [UIColor whiteColor]; // 自定义分页控件小圆标颜色
    [self addSubview:cycleScrollView];
    
    //
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        cycleScrollView.imageURLStringsGroup = arr;
    });
}

#pragma mark - SDCycleScrollViewDelegate

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    DLog(@"---点击了第%ld张图片", (long)index);
    if (self.pushConentView) {
        self.pushConentView(index);
    }
}

@end
